You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR addresses Issue #743 by introducing native support for CSV headers in parameterized tests, enabling referencing those headers using ${PARAM.columnName} syntax and replacing the old ignoreHeader logic.
About the issue & Error Handling:
I discovered that referencing headers in external CSVs was already partially implemented, so I created the required tests to prove and ensure that it works. To make it robust, I added a regex validation. If a user tries to reference a header that doesn't exist in the CSV file, it now throws a clear RuntimeException explicitly listing the invalid column and the available valid headers.
Replacing ignoreHeader with withHeaders:
I added the withHeaders field, which completely replaces and removes ignoreHeader. (Note: This is a breaking change for existing users using the old flag).
If the CSV that the user is using in their scenario (either internal or external) has headers, they should explicitly declare it by adding "withHeaders": true. The absence of this flag means that the CSV only contains raw data.
Additionally, withHeaders currently supports both piped (| |) and standard header syntax (no pipes), but the piped syntax is deprecated and should be removed in later versions.
Testing:
For everything I’ve changed, I created or fixed the corresponding unit and integration tests to prove and ensure that the feature works. I also fixed some other tests that broke due to these changes (e.g., the removal of ignoreHeader).
Checklist:
1. New Unit tests were added
1.1 Covered in existing Unit tests
2. Integration tests were added
2.1 Covered in existing Integration tests
3. Test names are meaningful
3.1 Feature manually tested and outcome is successful
4. PR doesn't break any of the earlier features for end users
4.1 WARNING! This might break one or more earlier earlier features, hence left a comment tagging all reviewrs.
Note: As agreed, the old ignoreHeader field has been removed and replaced by withHeaders. Existing user scenarios using the old flag will need to be updated.
5. PR doesn't break the HTML report features directly
5.1 Yes! I've manually run it locally and seen the HTML reports are generated perfectly fine
5.2 Yes! I've opened the generated HTML reports from the /target folder and they look fine
6. PR doesn't break any HTML report features indirectly
6.1 I have not added or amended any dependencies in this PR
6.2 I have double checked, the new dependency added or removed has not affected the report generation indirectly
6.3 Yes! I've seen the Sample report screenshots here, and HTML report of the current PR looks simillar.
7. Branch build passed in CI
8. No 'package.*' in the imports
9. Relevant Documentation page added or updated with clear instructions and examples for the end user
9.1 Not applicable. This was only a code refactor change, no functional or behaviourial changes were introduced
10. Http test added to http-testing-examples module(if applicable) ?
10.1 Not applicable. The changes did not affect HTTP automation flow
11. Kafka test added to kafka-testing-examples module(if applicable) ?
11.1 Not applicable. The changes did not affect Kafka automation flow
Documentation
CSV Headers
If a CSV has headers, you must explicitly set withHeaders:true in the parameterized section.
Hello, @authorjapps
Just a heads-up regarding the breaking change.
As discussed in Issue #743, I have completely removed the ignoreHeader field and replaced it with withHeaders.
Users should be noticed, so those who use ignoreHeader can migrate to withHeaders. Also, users who use CSV with headers (even in the existing tests with | | syntax for headers) should explicitly set withHeaders:true.
Tagging you for visibility on these changes!
@authorjapps@nirmalchandra Thanks for merging! I noticed that the current README still refers to the old ignoreHeader logic/documentation, which is now inconsistent with the latest changes in the Wiki and the v1.4.0 migration guide. Do you want me to open a PR that updates the README to ensure everything is in sync and provides the correct instructions to users?
@authorjapps@nirmalchandra Thanks for merging! I noticed that the current README still refers to the old ignoreHeader logic/documentation, which is now inconsistent with the latest changes in the Wiki and the v1.4.0 migration guide. Do you want me to open a PR that updates the README to ensure everything is in sync and provides the correct instructions to users?
Yes please @IgnatiosSar , go ahead. That'll help. Looks like this one was prior to the changes you made tothe Wiki page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support external CSV header referencing and replace
ignoreHeaderwithwithHeadersFixed Which Issue?
Fixes Feature: Named Parameter Support for External CSVs in Scenario DSL #743
PR Branch
https://github.com/IgnatiosSar/zerocode/tree/feature/743
Motivation and Context
This PR addresses Issue #743 by introducing native support for CSV headers in parameterized tests, enabling referencing those headers using ${PARAM.columnName} syntax and replacing the old
ignoreHeaderlogic.About the issue & Error Handling:
I discovered that referencing headers in external CSVs was already partially implemented, so I created the required tests to prove and ensure that it works. To make it robust, I added a regex validation. If a user tries to reference a header that doesn't exist in the CSV file, it now throws a clear
RuntimeExceptionexplicitly listing the invalid column and the available valid headers.Replacing
ignoreHeaderwithwithHeaders:withHeadersfield, which completely replaces and removesignoreHeader. (Note: This is a breaking change for existing users using the old flag)."withHeaders": true. The absence of this flag means that the CSV only contains raw data.withHeaderscurrently supports both piped (| |) and standard header syntax (no pipes), but the piped syntax is deprecated and should be removed in later versions.Testing:
For everything I’ve changed, I created or fixed the corresponding unit and integration tests to prove and ensure that the feature works. I also fixed some other tests that broke due to these changes (e.g., the removal of
ignoreHeader).Checklist:
1. New Unit tests were added
2. Integration tests were added
3. Test names are meaningful
3.1 Feature manually tested and outcome is successful
4. PR doesn't break any of the earlier features for end users
Note: As agreed, the old
ignoreHeaderfield has been removed and replaced bywithHeaders. Existing user scenarios using the old flag will need to be updated.5. PR doesn't break the HTML report features directly
/targetfolder and they look fine6. PR doesn't break any HTML report features indirectly
7. Branch build passed in CI
8. No 'package.*' in the imports
9. Relevant Documentation page added or updated with clear instructions and examples for the end user
10. Http test added to
http-testing-examplesmodule(if applicable) ?11. Kafka test added to
kafka-testing-examplesmodule(if applicable) ?Documentation
CSV Headers
If a CSV has headers, you must explicitly set withHeaders:true in the parameterized section.
Example
Referencing Headers in external CSVs
You can reference external CSV columns by their header names in your scenarios using ${PARAM.columnName}.
Example: External CSV
users.csvSample Scenario DSL
{ "scenarioName": "Test with named CSV parameters", "steps": [ { "name": "get_user_details", "url": "/users/${PARAM.username}", "operation": "GET", "request": {}, "assertions": { "status": 200, "body": { "login": "${PARAM.username}", "name": "${PARAM.fullname}", "location": "${PARAM.location}", "id": "(int)${PARAM.userid}" } } } ], "parameterized": { "withHeaders": true, "csvSource": "parameterized_csv/users.csv" } }Important Notes for the documentation
withHeaders:trueshould also be added in any other test that is using CSV with headers as an exampleignoreHeadershould be removed from any existing documentation